#include "graphics/camera.h"

namespace dw {
	namespace graphics {

std::ostream& operator << (std::ostream& os, const Camera& camera)
{
	os << dynamic_cast<const Object&>(camera);
	
	os.write(reinterpret_cast< const char* >(&camera.m_fov), sizeof (float));
	os.write(reinterpret_cast< const char* >(&camera.m_aspectRatio), sizeof (float));
	os.write(reinterpret_cast< const char* >(&camera.m_nearClipDist), sizeof (float));
	os.write(reinterpret_cast< const char* >(&camera.m_farClipDist), sizeof (float));
	
	return os;
}

std::istream& operator >> (std::istream& is, Camera& camera)
{
	is >> dynamic_cast< Object& >(camera);

	is.read(reinterpret_cast< char* >(&camera.m_fov), sizeof (float));
	is.read(reinterpret_cast< char* >(&camera.m_aspectRatio), sizeof (float));
	is.read(reinterpret_cast< char* >(&camera.m_nearClipDist), sizeof (float));
	is.read(reinterpret_cast< char* >(&camera.m_farClipDist), sizeof (float));
	
	return is;
}

	} // namespace graphics
} // namespace dw
